package com.asset.dispoal.file.bank.domain.service.command;

import com.asset.dispoal.file.bank.domain.db.mapper.FileBankMapper;
import com.asset.dispoal.file.bank.dto.FileBankDetailStatisticsResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import tech.mhuang.pacebox.core.ddd.BaseCommand;
import tech.mhuang.pacebox.springboot.protocol.Result;

@Component
public class FileBankDetailStaitsticsCommand implements BaseCommand<String, Result> {

    @Autowired
    private FileBankMapper bankMapper;


    public Result execute(String bankId) {
        FileBankDetailStatisticsResponse response = new FileBankDetailStatisticsResponse();
        response.setAmount(bankMapper.getAmountById(bankId));
        response.setDepartmentList(bankMapper.queryDepartmentStatistics(bankId));
        response.setReimburList(bankMapper.queryReimburStatistics(bankId));
        response.setYearMonthList(bankMapper.queryMonthList(bankId));
        return Result.ok(response);
    }
}